import { SocketMgr } from "./SocketMgr";

const { regClass, property } = Laya;

@regClass()
export class Start extends Laya.Script {

    onStart() {
        console.log("Game start");
        let token = Laya.Browser.getQueryString("token");
        if (token) {
            console.log("token = " + token);
            SocketMgr.getInstance().Token = token;
        }
        SocketMgr.getInstance().connect(token, Laya.Handler.create(this, (event: any) => {
            Laya.Scene.open("Game.ls");
        }));
    }
}